<Window x:Class="ScrumSprintMonitor.TestbenchApp.Views.TestbenchView.TestbenchWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ScrumSprintMonitor.TestbenchApp"
        Title="Scrum Sprint Monitor Testbench"
        Width="700" Background="Gray"
        WindowStartupLocation="CenterScreen"
        Opacity="0.75" Activated="OnWindowActivated" MouseLeftButtonDown="OnWindowMouseLeftButtonDown">

	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="pack://application:,,,/ScrumSprintMonitor.UI.Wpf;component/Styles/FormResourceDictionary.xaml" />
			</ResourceDictionary.MergedDictionaries>

			<local:XamlServiceLocator x:Key="serviceLocator" />
		</ResourceDictionary>
	</Window.Resources>

	<Window.Style>
		<StaticResource ResourceKey="DefaultChrome" />
	</Window.Style>

	<Grid DataContext="{Binding Path=TestbenchViewModel, Source={StaticResource serviceLocator}}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<Label Style="{StaticResource LabelStyle}" Grid.Row="0" Grid.Column="0" Content="Current _Build Status:" Target="{Binding ElementName=CurrentBuildStatus}" />
		<ComboBox x:Name="CurrentBuildStatus" Style="{StaticResource ComboBoxStyle}" Grid.Row="0" Grid.Column="1" ItemsSource="{Binding AvailableBuildStatus}" SelectedValue="{Binding CurrentBuildStatus}" VerticalAlignment="Center" />

		<ContentControl Grid.Row="1" Grid.ColumnSpan="2" ContentTemplate="{StaticResource Separator}" Content="Work Items" IsTabStop="False" />
		<DataGrid Margin="0,3" Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding WorkItems}" ItemStringFormat="" GridLinesVisibility="All" Foreground="Black" CanUserAddRows="True" CanUserDeleteRows="True" BorderThickness="1" AlternationCount="1" AlternatingRowBackground="WhiteSmoke" VerticalGridLinesBrush="Gainsboro" HorizontalGridLinesBrush="Cornsilk" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" AreRowDetailsFrozen="True" AutoGenerateColumns="False" VerticalContentAlignment="Center">
			<DataGrid.Columns>
				<DataGridTextColumn Header="#" Binding="{Binding Path=Id}" Width="Auto" IsReadOnly="True" />
				<DataGridTextColumn Header="Type" Binding="{Binding Path=Type}" Width="Auto" IsReadOnly="True" />
				<DataGridTemplateColumn Header="State" Width="80">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding State}" VerticalAlignment="Center" Margin="3" />
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
					<DataGridTemplateColumn.CellEditingTemplate>
						<DataTemplate>
							<ComboBox ItemsSource="{Binding Path=TestbenchViewModel.ValidWorkItemStates, Source={StaticResource serviceLocator}}" SelectedItem="{Binding State}" IsDropDownOpen="True" />
						</DataTemplate>
					</DataGridTemplateColumn.CellEditingTemplate>
				</DataGridTemplateColumn>
				<DataGridTextColumn Header="Title" Binding="{Binding Title}" Width="*" />
				<DataGridTextColumn Header="Done Work" Width="Auto" Binding="{Binding DoneWork}" />
				<DataGridTextColumn Header="Remaining Work" Width="Auto" Binding="{Binding RemainingWork}" />
				<DataGridTemplateColumn Header="Assigned To" Width="Auto">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding AssignedTo}" VerticalAlignment="Center" Margin="3" />
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
					<DataGridTemplateColumn.CellEditingTemplate>
						<DataTemplate>
							<ComboBox ItemsSource="{Binding Path=TestbenchViewModel.ValidTeamMembers, Source={StaticResource serviceLocator}}" SelectedItem="{Binding AssignedTo}" IsDropDownOpen="True" />
						</DataTemplate>
					</DataGridTemplateColumn.CellEditingTemplate>
				</DataGridTemplateColumn>
			</DataGrid.Columns>
		</DataGrid>

		<Label Style="{StaticResource LabelStyle}" Grid.Row="3" Grid.Column="0" Content="Team Member making c_hanges:" Target="{Binding ElementName=TeamMemberMakingChanges}" />
		<ComboBox x:Name="TeamMemberMakingChanges" Style="{StaticResource ComboBoxStyle}" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding ValidTeamMembers}" SelectedItem="{Binding CurrentCommiter}" />

		<Button Grid.Row="4" Grid.ColumnSpan="2" Content="_Close" Command="{Binding CloseCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" HorizontalAlignment="Right" Padding="12,6" Margin="0,3" IsDefault="True" />
	</Grid>
</Window>